package com.handinglian.servicerecord.enums;

public enum RecordStateEnum {
    CALL_IN(0,"打入"),
    CALL_OUT(1,"打出"),
    INNER(-1,"内线");

    public static RecordStateEnum valueOfOrdinal(Integer ordinal) {
        return ordinal == null || ordinal >= values().length ? null : values()[ordinal];
    }
    public static RecordStateEnum valueOfDesc(String desc) {
        for(RecordStateEnum recordStateEnum : RecordStateEnum.values()){
            if(desc.equals(recordStateEnum.getDescription())){
                return recordStateEnum;
            }
        }
        return null;
    }
    public static RecordStateEnum valueOfKey(Integer key){
        for(RecordStateEnum recordStateEnum : RecordStateEnum.values()){
            if(recordStateEnum.getKey()==key){
                return recordStateEnum;
            }
        }
        return null;
    }
    private final Integer key;
    private final String description;

    RecordStateEnum(Integer key, String description) {
        this.key = key;
        this.description = description;
    }

    public Integer getKey() {
        return key;
    }
    public String getDescription() {
        return this.description;
    }
}
